/*
 * @Author: 李环玉 834654733@qq.com
 * @Date: 2023-11-25 19:03:01
 * @LastEditors: 李环玉 834654733@qq.com
 * @LastEditTime: 2023-11-26 19:39:24
 * @FilePath: \new-nuxt-blog\nuxt.config.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// https://nuxt.com/docs/api/configuration/nuxt-config
import Components from 'unplugin-vue-components/vite';
import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
export default defineNuxtConfig({
  devtools: { enabled: true },
  css:[
    '@/assets/styles/reset.css',
    '@/assets/styles/player.css',
    '@/assets/styles/myFont.css',
    '/public/icon/colorfont/iconfont.css',
    '@/assets/icon/iconfont/iconfont.css',
  ],
  build: {
    // 配置构建选项
  },
  components: true,
  modules: [],
  plugins: [
      // 配置使用的插件
  ],
  router: {
      // 配置路由选项
  },
  vite: {
    plugins: [
        Components({
            resolvers: [NaiveUiResolver()], // Automatically register all components in the `components` directory
        }),
    ],
    // @ ts-expect-error: Missing ssr key
    ssr: {
        noExternal: ['moment', 'naive-ui', '@juggle/resize-observer', '@css-render/vue3-ssr'],
    },
    // envDir: '~/env', // 指定env文件夹
    optimizeDeps: {
        include: ['@vicons/ionicons5']
    },
    css:{
      preprocessorOptions: {
        scss: {
          additionalData: '@import "assets/styles/variable.scss";',
        }
      }
    }
  },
  nitro:{
    devProxy:{
      '/api':{
        target:'http://localhost:3002',
        changeOrigin:true,
        prependPath: true
      }
    },
    // 该配置用于服务端请求转发
    routeRules: {
      '/api/**': {
        proxy: 'http://localhost:3002/**'
      }
    }
  },
})
